package com.example.demo.strategy.CalculationStrategy;

import com.example.demo.enums.CalculationEnum;
import com.example.demo.strategy.CalculationMethodStrategy;
import org.hibernate.service.spi.InjectService;
import org.springframework.stereotype.Service;

@Service(value = "NotIncludeStrategy")
public class NotIncludeStrategy implements CalculationMethodStrategy {
    @Override
    public boolean calculate(String preContent, String value) {
        if (value != null) {
            String[] valItems = value.split("\\|");
            for (String item : valItems) {
                if (item.equals(preContent)) {
                    return false;
                }
            }
        }
        return true;
    }

    @Override
    public CalculationEnum getCalculationEnum() {
        return CalculationEnum.NOT_INCLUDE;
    }
}
